
// HookDlg.h : header file
//

#pragma once
#include "afxwin.h"
#include "vector"
#include <time.h>

class CMsg
{
public:
	UINT		m_nMessage;
	WPARAM		m_wParam;
	LPARAM		m_lParam;

	DWORD		m_timeSpan;

	bool operator == ( const CMsg& value)
	{
		return m_nMessage == value.m_nMessage &&
				m_wParam == value.m_wParam && 
				m_lParam == value.m_lParam &&
				m_timeSpan == value.m_timeSpan;
	}

	CMsg(void)
		: m_nMessage(0)
		, m_wParam(0)
		, m_lParam(0)
		, m_timeSpan(0)
	{
	}

	CMsg(UINT nMsg, WPARAM wParam, LPARAM lParam, DWORD timeSpan)
		: m_nMessage(nMsg)
		, m_wParam(wParam)
		, m_lParam(lParam)
		, m_timeSpan(timeSpan)
	{
	}
};

// CHookDlg dialog
class CHookDlg : public CDialogEx
{
// Construction
public:
	CHookDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	enum { IDD = IDD_HOOK_DIALOG };

	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support


// Implementation
protected:
	HICON					m_hIcon;
	CListBox				m_listBoxMsg;

	DWORD					m_timeStartHook;
	std::vector<CMsg>		m_listMsg;
	
	// Generated message map functions
	virtual BOOL OnInitDialog();
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	DECLARE_MESSAGE_MAP()

public:
	void LogMouseMsg(UINT nMsg, WPARAM wParam, LPARAM lParam, DWORD timeSpan);

public:
	afx_msg void OnBnClickedButtonHook();
	afx_msg void OnBnClickedButtonUnhook();
	afx_msg LRESULT OnMyNcMouseMove(WPARAM, LPARAM param);
	afx_msg LRESULT OnMyNcMouseLDBClick(WPARAM, LPARAM param);
	afx_msg LRESULT OnMyNcMouseLButtonUp(WPARAM, LPARAM param);
	afx_msg LRESULT OnMyNcMouseLButtonDown(WPARAM, LPARAM param);
	afx_msg LRESULT OnMyNcMouseRButtonUp(WPARAM, LPARAM param);
	afx_msg LRESULT OnMyNcMouseRButtonDown(WPARAM, LPARAM param);
	afx_msg LRESULT OnMyMouseMove(WPARAM, LPARAM param);
	afx_msg LRESULT OnMyMouseLDBClick(WPARAM, LPARAM param);
	afx_msg LRESULT OnMyMouseLButtonUp(WPARAM, LPARAM param);
	afx_msg LRESULT OnMyMouseLButtonDown(WPARAM, LPARAM param);
	afx_msg LRESULT OnMyMouseRButtonUp(WPARAM, LPARAM param);
	afx_msg LRESULT OnMyMouseRButtonDown(WPARAM, LPARAM param);
	afx_msg void OnNcDestroy();
};
